package cn.com.xyc.aop.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

import cn.com.xyc.aop.common.PropertiesUtil;

@Component
@Aspect
public class AspectOptLogger {

	@Pointcut("within(cn.com.xyc.aop.service.impl.SystemServiceImpl)")
	public void systemServicePointCut() {
	}

	@Around("systemServicePointCut()")
	public Object logger(ProceedingJoinPoint pjp) throws Throwable {
		Object obj = pjp.proceed();

		String methodName = pjp.getSignature().getName();
		String clazzName = pjp.getTarget().getClass().getName();

		PropertiesUtil.getInstance("opt.properties");
		String key = clazzName + "." + methodName;
		System.out.println("执行了" + PropertiesUtil.getProperty(key));
		return obj;
	}
}
